package com.obtk.service.impl;

import com.obtk.mapper.OrderLineMapper;
import com.obtk.model.OrderLine;
import com.obtk.service.OrderLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能说明
 *
 * @author Mr.Sun
 * @date 2023-04-03 17:03:16
 */
@Service
public class OrderLineServiceImpl implements OrderLineService {
    @Autowired
    private OrderLineMapper orderLineMapper;
    @Override
    public List<OrderLine> selectOrderLine(OrderLine orderLine) {
        return orderLineMapper.selectOrderLine(orderLine);
    }

    @Override
    public OrderLine selectByoOddOrderId(Integer oddOrderId,Integer oddProdId) {
        return orderLineMapper.selectByoOddOrderId(oddOrderId,oddProdId);
    }

    @Override
    public int register(OrderLine orderLine) {
        orderLine.setOddStatus(1);
        int a = orderLineMapper.insert(orderLine);
        return a;
    }

    @Override
    public OrderLine selectByOddProdId(Integer oddProdId) {
        return orderLineMapper.selectByOddProdId(oddProdId);
    }

    @Override
    public int updateByOddId(OrderLine orderLine) {
        return orderLineMapper.updateByOddId(orderLine);
    }

    @Override
    public int updateStatusBatch(List<String> oddIds, Integer oddStatus) {
        Map<String,Object> params = new HashMap<String,Object>(2);
        params.put("oddIds",oddIds);
        params.put("oddStatus",oddStatus);
        return orderLineMapper.updateStatusBatch(params);
    }

}
